# 导包
import requests
import config


# 创建接口类
class StaffAPI:
    # 初始化
    def __init__(self):
        self.url = config.BASE_URL + "/api/sys/user"

    # 员工添加
    def insert_staff(self, insert_data, token):
        return requests.post(url=self.url, json=insert_data, headers={"Authorization": token})

    # 员工查询
    def select_staff(self, staff_id, token):
        return requests.get(url=self.url + "/" + staff_id, headers={"Authorization": token})

    # 员工修改
    def update_staff(self, staff_id, token, update_data):
        return requests.put(url=self.url + "/" + staff_id, json=update_data, headers={"Authorization": token})

    # 员工删除
    def delete_staff(self, staff_id, token):
        return requests.delete(url=self.url + "/" + staff_id, headers={"Authorization": token})
    # 员工管理列表


if __name__ == '__main__':
    insert_data = {
        "username": "jack88888",
        "mobile": "19736728172",
        "workNumber": "jack19736728171"
    }
    response = StaffAPI().insert_staff(insert_data=insert_data, token='23babf52-cf07-42e0-adde-3c25327fe7ac')
    print(response.json())